import { request, myBaseUrl } from "./request";

export function getMaterailData() {
  return request({
    url: "/GPX/product/status",
  });
}
export function getLineMachine() {
  return request({
    url: "/FactoryInfo/GPX/LineMachineInfos",
  });
}
//单台机器
export function getGPXsingle(params) {
  return request({
    url: `/GPX/product/status/machine`,
    params: params,
  });
}
// 单台机器稼动率
export function getGPXsingleUtilization(params) {
  return request({
    url: `/GPX/product/status/machine/utilization`,
    params: params,
  });
}
// 获取eventlog
export function getGPXsingleEventlog(params) {
  return request({
    url: `/GPX/product/status/machine/MachineEvents`,
    params: params,
  });
}
//
//SSE
export const gpxDateSSEUrl = myBaseUrl + `/GPX/product/status/SSE`;
export function getSingleGPXDateSSEUrl(params) {
  const querys = [];
  for (const key in params) {
    querys.push(`${key}=${params[key]}`);
  }
  return myBaseUrl + `/GPX/product/status/machine/SSE?` + querys.join("&", querys);
}
/* GPX Server 状态*/
// gpx连接状态
export function fetchSystemStatus() {
  return request({
    url: "/GPX/MESLinkConnStatus",
  });
}
// gpx启动
export function fetchSystemStart(data) {
  return request({
    url: "/GPX/GPXServer/Start",
    method: "post",
    data: data,
  });
}
